local sk__huisheng = fk.CreateSkill {

  name = "sk__huisheng",

  tags = {  },

}



sk__huisheng:addEffect(fk.DamageInflicted, {
  name = "sk__huisheng",
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__huisheng.name) and not player:isKongcheng() and data.from and data.from ~= player
      and not data.from.dead
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local cards = room:askForCard(player, 1, 3, true, sk__huisheng.name, true, ".", "#sk__huisheng-invoke::"..data.from.id)
    if #cards > 0 then
      event:setCostData(self, cards)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = event:getCostData(self)
    local n = #cards
    local get = room:askForCardChosen(data.from, player, {card_data = {{player.general, cards}}}, sk__huisheng.name)
    if #room:askForDiscard(data.from, n, n, true, sk__huisheng.name, true, ".",
      "#sk__huisheng-discard::"..player.id..":"..n..":"..Fk:getCardById(get, true):toLogString()) ~= n then
      room:moveCardTo(get, Card.PlayerHand, data.from, fk.ReasonPrey, sk__huisheng.name, nil, false, data.from)
      return true
    end
  end,
})

return sk__huisheng